package org.example.test.interpreter;

import org.example.design.interpreter.test2.Context;
import org.example.design.interpreter.test2.MinusOperation;
import org.example.design.interpreter.test2.PlusOperation;
import org.example.design.interpreter.test2.TerminalExpression;

/**
 * @author huangshen
 * @version 0
 * @description InterpreterTest2
 * @since 2022/2/14 14:27
 */
public class InterpreterTest2 {

    public static void main(String[] args) {
        Context context = new Context();

        TerminalExpression a = new TerminalExpression("a");
        TerminalExpression b = new TerminalExpression("b");
        TerminalExpression c = new TerminalExpression("c");

        context.add(a, 4);
        context.add(b, 8);
        context.add(c, 2);

        System.out.println(new MinusOperation(new PlusOperation(a,b), c).interpreter(context));
    }
}
